package com.darrenchan.leetcode;

/**
 * @Desc
 * @Author chenchi03
 * @CreateTime 2020-01-27 03:58
 */
public class QLint394 {
    public boolean firstWillWin(int n) {
        if (n == 0) return false;
        if (n == 1) return true;
        boolean[] dp = new boolean[2];
        dp[0] = false;
        dp[1] = true;
        for (int i = 2; i <= n; i++) {
            dp[i % 2] = !(dp[(i - 1) % 2] && dp[(i - 2) % 2]);
        }
        return dp[n % 2];
    }
}
